#include <stdio.h>

int main(int argc, char *argv[]) {

    int a, b, c, d,lt,lm;
    scanf("%d %d %d %d", &a, &b, &c, &d);

    lt = c - a;
    lm = d - b;

    if (lm>=0)
    {
       printf("%d %d",lt,lm);
    }else{
        lm = lt * 60 + lm;

        if(lm>=60){
            lt = lm / 60;
            lm = lm - (lt * 60);
            printf("%d %d", lt, lm);
        }else{
            printf("0 %d", lm);
        }
    }
    return 0;
}